<div class="mainarea">

<div class="tabs_header">
	<ul class="tabs">
		<li><a href="{CPURL}?action=click"><span>浏览分组</span></a></li>
		<li class="null"><a href="{CPURL}?action=click&op=add">添加新分组</a></li>
		<li><a href="{CPURL}?action=click&type=click"><span>浏览全部动作</span></a></li>
		<li class="null"><a href="{CPURL}?action=click&type=click&op=add">添加新动作</a></li>
	</ul>
</div>

<!--{if empty($_GET['op'])}-->

	<div id="newslisttab">
		<ul>
			<!--{loop $clickgroup $value}-->
			<li<!--{if $value[groupid] == $_GET[gid]}--> class="active"<!--{/if}-->><a href="{CPURL}?action=click&type=click&gid=$value[groupid]"><span>$value[grouptitle]</span></a></li>
			<!--{/loop}-->
		</ul>
	</div>

	<form method="post" action="{CPURL}?action=click">
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
	<div class="bdrcontent">
		<table cellspacing="0" cellpadding="0" class="formtable">
		<tr>
			<th width="70">图标</th>
			<th>动作名称(id)</th>
			<th>分组(id)</th>
			<th width="80">显示顺序</th>
			<th width="80">点击分值</th>
			<th width="80">状态</th>
			<th width="80">类型</th>
			<th width="80">&nbsp;</th>
		</tr>
		<!--{loop $list $value}-->
		<tr>
			<td><!--{if $value[icon]}--><img src="images/click/$value[icon]"><!--{/if}--></td>
			<td>$value[name]($value[clickid])</td>
			<td><!--{if $clickgroup[$value[groupid]]}-->$clickgroup[$value[groupid]][grouptitle]($value[groupid])<!--{else}-->未分组<!--{/if}--></td>
			<td><input type="text" name="displayorder[{$value[clickid]}]" value="$value[displayorder]" size="5"></td>
			<td><input type="text" name="score[{$value[clickid]}]" value="$value[score]" size="5"></td>
			<td><a href="{CPURL}?action=click&type=click&op=status&clickid=$value[clickid]"><!--{if $value['status']}-->开启<!--{else}-->关闭<!--{/if}--></a></td>
			<td><!--{if $value['system']}-->系统功能<!--{else}-->-<!--{/if}--></td>
			<td>
				<a href="{CPURL}?action=click&type=click&op=edit&clickid=$value[clickid]">编辑</a>
				<!--{if !$value[system]}-->
				 | 
				<a href="{CPURL}?action=click&type=click&op=delete&clickid=$value[clickid]" onclick="return confirm('删除不可恢复\n并会同时清除相关统计数据\n确认删除？');">删除</a>
				<!--{/if}-->
			</td>
		</tr>
		<!--{/loop}-->
		</table>
	</div>
	<div class="footactions">
		<input type="submit" name="ordersubmit" value="提交" class="submit">
	</div>

	</form>

<!--{elseif $_GET['op'] == 'add' || $_GET['op'] == 'edit'}-->

	<form method="post" action="{CPURL}?action=click">
	<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
		
	<div class="bdrcontent">
		
		<table cellspacing="0" cellpadding="0" class="formtable">
		<tr><th style="width:12em;">动作名称<span style="color:#F00">*</span></th>
			<td><input type="text" name="name" value="$click[name]"></td></tr>
		<tr><th>动作图标</th>
			<td>./images/click/<input type="text" name="icon" value="$click[icon]" size="15">
			<br>需要确保将该图片上传到程序的 ./images/click/ 目录下面。
			</td></tr>
		<tr><th>显示顺序</th>
			<td><input type="text" name="displayorder" value="$click[displayorder]"></td></tr>
		<tr><th>分组<span style="color:#F00">*</span></th>
			<td>
			<!--{if $_GET['op'] != 'edit'}-->
			<select name="groupid">
			<option value="0">请选择</option>
			<!--{loop $clickgroup $value}-->
			<option value="$value[groupid]">$value[grouptitle]</option>
			<!--{/loop}-->
			</select>
			<!--{else}-->
			$clickgroup[$click[groupid]][grouptitle]
			<!--{/if}-->
			</td></tr>
		<tr><th>点击分值</th>
			<td><input type="text" name="score" value="$click[score]"></td></tr>
		<tr><th>状态</th>
			<td><input type="radio" name="status" value="1"<!--{if $click[status]}--> checked<!--{/if}-->> 开启
				<input type="radio" name="status" value="0"<!--{if !$click[status]}--> checked<!--{/if}-->> 关闭</td></tr>
		</table>
	</div>
	
	<div class="footactions">
		<input type="hidden" name="clickid" value="$click[clickid]">
		<!--{if $_GET['op'] == 'edit'}-->
		<input type="hidden" name="groupid" value="$click[groupid]">
		<!--{/if}-->
		<input type="submit" name="clicksubmit" value="提交" class="submit">
	</div>

	</form>

<!--{/if}-->
</div>
